using System;

namespace random
{
    class Program                               
    {                                           
        static void Main(string[] args)
        {
            string answer = "y";

            int totalscore = 0, score = 0;
            while (answer == "y")   //loop for more generations of random number
            {
                Random game = new Random();


                int a = (byte)game.Next(1, 10); //number range
                Console.WriteLine("{0}", a);
                int b = (byte)game.Next(1, 10);
                Console.WriteLine("{0}", b);
                int c = (byte)game.Next(1, 10);
                Console.WriteLine("{0}", c);



                if ((a == 9) & (b == 9) & (c == 9)) //Jackpot 999
                    score = 2000;
                else
                if ((a == b) & (b == c) & (c != 9) & (a != 9) & (b != 9)) // 3 same numbers different than 9
                    score = 15;
                else
                if ((a == 9) & (b == 9) & (c != 9))  // two same numbers 9, A = b
                    score = 200;
                else
                if ((b == 9) & (a != 9) & (c == 9)) // two same numbers 9, b = c 
                    score = 200;
                else
                if ((c == 9) & (b != 9) & (a == 9)) // two same numbers 9, a = c         
                    score = 200;
                else
                if ((a == b) | (b == c) | (a == c) & ((a != 9) & (b != 9) & (c != 9)))  // two same numbers different than 9
                    score = 5;
                else
                if ((a != b) & (b != c) & (a != c))  // All different number, 0 points
                {
                    score = 0;
                    Console.WriteLine("Game over!!!");
                }

                Console.WriteLine("Your score is : {0}", score);
                  
                if (score == 0)
                     totalscore = 0;
                else
                totalscore = totalscore + score;

                Console.WriteLine("Totalscore is : {0}", totalscore);                              
               Console.WriteLine("Would you like to spin again? tipe y or n");           
                answer =Console.ReadLine();
            }
            
            Console.WriteLine("Total score: {0}", totalscore);
        }
    }
}
